#!/usr/bin/make -f

PLATFORM_NAME := x86_64-accton_wedge100bf_32x-r0
PACKAGE_NAME := sonic-platform-modules-bfn-montara
SCRIPT_SRC := $(shell pwd)/scripts
CONFIGS_SRC := $(shell pwd)/configs
BUILD_DIR := $(shell pwd)/build
WHEEL_BUILD_DIR := $(BUILD_DIR)/wheel

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_build:
	set -e
	python3 setup.py bdist_wheel -d $(WHEEL_BUILD_DIR)
	set +e

override_dh_auto_install:
	dh_installdirs -p$(PACKAGE_NAME) usr/local/bin
	cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_NAME)/usr/local/bin
	dh_installdirs -p$(PACKAGE_NAME) etc/network/interfaces.d/
	cp -r $(CONFIGS_SRC)/network/interfaces.d/* debian/$(PACKAGE_NAME)/etc/network/interfaces.d/
	dh_installdirs -p$(PACKAGE_NAME) usr/share/sonic/device/$(PLATFORM_NAME)/
	cp -r $(WHEEL_BUILD_DIR)/*  debian/$(PACKAGE_NAME)/usr/share/sonic/device/$(PLATFORM_NAME)/

override_dh_usrlocal:

override_dh_clean:
	rm -fr $(WHEEL_BUILD_DIR)
	rm -fr *.egg-info
	rm -fr $(BUILD)
	dh_clean
